package com.dadibadi.core.member.controller;

import com.dadibadi.core.dao.entity.MemberApplyTab;
import com.dadibadi.core.dao.mapper.MemberApplyMapper;
import com.dadibadi.core.member.qo.MemberApplyIdQO;
import com.dadibadi.core.member.vo.MemberApplyDetailVO;
import com.venusoft.developer.common.result.CommonResult;
import com.venusoft.developer.common.result.ICommonResult;
import com.venusoft.developer.common.utils.ConvertUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author : lkfs@163.com
 * @date : 2025-08-25 15:53
 */

@RestController
@RequestMapping("/api")
@Slf4j
@Tag(name = "api/会员管理", description = "")
public class AdminMemberApplyGetController {
    @Resource
    private MemberApplyMapper memberApplyMapper;

    @PostMapping("/admin-member-apply-get")
    @Operation(summary = "详情", description = "")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", content = {@Content(schema = @Schema(implementation = MemberApplyDetailVO.class), mediaType = "application/json")})})
    public ICommonResult exec(
            @RequestBody @Parameter(required = true) @Validated MemberApplyIdQO qo,
            @RequestHeader(required = false) String platform,
            @RequestHeader(required = false) String version,
            @RequestHeader(required = false, name = "Accept-Language") String language,
            HttpServletRequest request) {

        MemberApplyTab memberApplyTab = memberApplyMapper.selectById(qo.getUserId());
        MemberApplyDetailVO vo = ConvertUtil.convert(memberApplyTab, MemberApplyDetailVO.class);
        return new CommonResult<>(vo);


    }
}
